import 'package:app/common/app_theme.dart';
import 'package:app/pages/userinfo_module/userinfo_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:get/get.dart';

class UserInfoUpDataView extends GetView {



  var title;

  var controllerText;

  UserInfoUpDataView(this.title,{this.controllerText});


  UserInfoController controller = Get.put(UserInfoController());

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        actions: [
          TextButton(onPressed: (){
            if(title == '修改昵称'){
              controller.tapClickDone();
            }else{
              controller.tapClickAddressDone();
            }
          }, child: Text('完成'))
        ],
        title: Text('${title}',style: appThemeData.textTheme.bodyText1!.copyWith(fontSize: 17),),
        leading: IconButton(
          onPressed: () {
            Get.back();
          },
          icon: Image.asset(
            'images/leftarr.png',
            width: 15,
            height: 15,
          ),
        ),
      ),
      body:GetBuilder<UserInfoController>(builder: (_){
        return  Container(
          margin: EdgeInsets.only(left: 15,right: 15,top: 10),
          child: TextField(
            controller: controller.editingController..text = controllerText,
            inputFormatters: <TextInputFormatter>[
              LengthLimitingTextInputFormatter(13) //限制长度
            ],
            autofocus: true,
            decoration: InputDecoration(
                hintText: ''
            ),
          ),
        );
      }),
    );
  }
}
